package com.bw.house.adapter


import android.graphics.Color
import android.widget.TextView
import com.bw.house.R
import com.bw.house.result.HouseResult
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

class HouseAdapter :BaseQuickAdapter<HouseResult,BaseViewHolder>(R.layout.house_item) {


    override fun convert(holder: BaseViewHolder, item: HouseResult) {
        holder.setText(R.id.id,"${item.id}室")
        holder.getView<TextView>(R.id.state).apply {
            setBackgroundColor(if(item.rented) Color.GREEN else  Color.RED )
            text=if(item.rented) "出租" else "未出租"
        }
        holder.setText(R.id.requestName,"企业: ${item.enterpriseName}")
        holder.setText(R.id.mm,"面积: ${item.area}")
    }
}